<style type="text/css">   
     .toolbar {
        /*float: right;*/
        padding-top: 12px;
        padding-left: 20px;
        padding-bottom: 12px;
    }

    form {
        margin: 0 0 0px;
    }
        
     .form-horizontal .control-group {
    margin-bottom: 6px;
    }
    
    .form-horizontal .control-label {
float: left;
width: 140px;
padding-top: 5px;
text-align: right;
}

.form-horizontal .controls {
margin-left: 160px;
}
</style>
<div class="row-fluid">
<div class="span">
<div class="box">
<div class="title">
<h4><span class="icon16 cc-icon-list-4"></span> <span>{$title }</span>
</h4>
<a href="#" class="minimize" style="display: none;">Minimize</a></div>
<div class="content noPad clearfix">
<form id="fm_module_remove" class="form-horizontal form-inline" action="__APP__/System/users_remove" method="post">         
<div class='toolbar'>
    <span>
    <a id='btnnew' class="btn btn-small" data-toggle="modal" href="#mod_module_add" data-keyboard="false" data-backdrop="false">
      <i class="icon-plus "></i> 新增用户 </a>
    <a id='btn_edit' class="btn btn-small " data-toggle="modal" href="#" >
      <i class="cc-icon-pencil-4 "></i> 修改用户 </a>  
    <button type="submit" id="btndel" class="btn btn-small btn-danger"><i class="icon-trash icon-white"></i> 删除用户</button>
    </span>
</div>

<table id="client_data" cellpadding="0" cellspacing="0" border="0" class="dynamicTable display table table-bordered">
        <thead>
            <tr>

                <th style="width:5px;" id="cbx"><input type="checkbox" id="checkall" onclick="selAll()" /></th>
                <th style="width:10%;">用户名</th>
                <th style="width:20%;">用户描述</th>
                <th style="width:80px;">联系方式</th>
                <th style="width:100px;">E-mail</th>
                <th style="width:120px;">用户组</th>
                <th style="width:120px;">建立时间</th>
                <th style="width:30px;">启用</th>

            </tr>
        </thead>
        <tbody>
             <iterate name="data" id="item">

                <tr>
                    <td id="cbx"><input type="checkbox" id="ids[]" name="ids[]" value="{$item['Id']}" class="nostyle"/></td>              
                    <td>{$item['UserName']}</td>
                    <td style="text-align: left;"><php>echo nl2br($item['UserInfo']);</php></td>

                    <td>{$item['Phone']}</td>
                    <td>{$item['Email']}</td>
                    <td>{$item['LevelName']}</td>
                    <td>{$item['CreateTime']}</td>
                    <td>
                        <if condition="($item['Status'] eq 1)">
                           <span class="icon12 blue cc-icon-checkmark"></span>
                        </if>
                        <if condition="($item['Status'] eq 0)">
                           <span class="icon12 red cc-icon-cancel"></span>
                        </if>
                     </td>
                </tr>

            </iterate>
        </tbody>
    </table>
</form>

</div>
</div>
    
<form id="fm_module_add" class="form-horizontal form-inline" action="__APP__/System/users_add" method="post">    
<div class="modal hide" id="mod_module_add">
  <div class="modal-header">
    <a class="close" data-dismiss="modal">×</a>
    <h4>
        <span>新增用户</span></h4>
  </div>
  <div class="modal-body ">

        
        <fieldset>
            <div class="control-group">
                <label class="control-label" for="">用户名</label>
                <div class="controls">
                    <input type="text" id="UserName" name="UserName" style="width:120px;" value=""/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="">密码</label>
                <div class="controls">
                    <input type="password" id="PassWord" name="PassWord" style="width:120px;" value=""/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="">确认密码</label>
                <div class="controls">
                    <input type="password" id="PassWord2" name="PassWord2" style="width:120px;" value=""/>
                </div>
            </div><!--
            <div class="control-group">
                <label class="control-label" for="">局点</label>
                <div class="controls">
                    <tagLib name="html" /> 
		    <html:select id="DepartId" name="DepartId" options="depart_id" /> 
                </div>
            </div>
            --><div class="control-group">
                <label class="control-label" for="">用户描述</label>
                <div class="controls">
                  <textarea align="left"  rows="4" cols="40" id="UserInfo" name="UserInfo" style="width:370px"></textarea>
                </div>
            </div>
            
            <div class="control-group">
                <label class="control-label" for="">联系方式</label>
                <div class="controls">
                  
                  <input type="text" id="Phone" name="Phone" style="width:120px;" value=""/>
                </div>
            </div>     
            <div class="control-group">
                <label class="control-label" for="">E-mail</label>
                <div class="controls">
                    <input type="Email" id="Action" name="Email" style="width:200px;" value=""/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="">用户组</label>
                <div class="controls">
                    <tagLib name="html" /> 
		    <html:select id="UserLevel" name="UserLevel" options="levels" /> 
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="Status">启用</label>
                <div class="controls marginT5">
                   <input id="Status" name="Status" type="checkbox" checked="checked" >                   
                </div>
            </div>
        </fieldset>

  </div>
  <div class="modal-footer">
    <button type="submit" class="btn btn-small btn-primary" id="loginBtn"><span class="cc-icon-checkmark-3 white"></span> 确定</button>
    <a href="#" class="btn btn-small btn-danger" data-dismiss="modal"><span class="cc-icon-cancel-4 white"></span>关闭</a>
 </div>
</div>
</form>    
<script type="text/javascript">
     $(function(){
         //$("input, textarea, select").not(".nostyle").uniform();
         //$('.normal-toggle-button').toggleButtons();
         
         $('#checkall').click(function(){ //alert(this.checked)
            $('input[type="checkbox"]').attr("checked",this.checked); 
        });
        
        $("#btndel").click(function(){
           return window.confirm("确认要批量删除吗?");
        });
        
        $("#btn_edit").click(function(){ 
           var s = $("table input:checked").first();
           
           if ($(s).val() == undefined){
               alert('请选择要修改的模块!');
               return false;
           }

           window.location.href="__URL__/users_edit?id="+encodeURI($(s).val());  
        });
         
         $("#fm_module_add").validate({
            rules: {
                    UserName : "required",
                    PassWord : {minlength:6,required:true},
                    PassWord2 :  {equalTo:"#PassWord"},
                    Email :  {email:true}
            },
            messages: {
                    UserName : "请输入用户名称!",
                    PassWord :{required:"请输入密码!",minlength:"长度必须达到6位以上！"},
                    PassWord2 :"两次密码不一样!",
                    Email :"E-mail 格式不正确!"

            }
        });
        
        $('#mod_module_add').on('show', function () {
            // do something…
            document.getElementById("fm_module_add").reset();
        })
     });
     
</script>
        